﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>华科大交易溯源系统</title>
    <link rel="stylesheet" href="layuiadmin/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="layuiadmin/css/style.css">

</head>

<body>


<div class="materialContainer" >
    <div class="box">
        <div class="title">华科大交易溯源系统</div>
        <form action="/doLogin" method="post">
            <div class="input">
                <label for="name">用户名</label>
                <input type="text" name="username" id="name">
                <span class="spin"></span>
            </div>
            <div class="input">
                <label for="pass">密码</label>
                <input type="password" name="password" id="pass">
                <span class="spin"></span>
            </div>
            <div class="button login">
                <button type="submit">
                    <span>登录</span>
                    <i class="fa fa-check"></i>
                </button>
            </div>
        </form>
        <!--<a href="javascript:" class="pass-forgot">忘记密码？</a>-->
    </div>


            <div class="overbox">
                <div class="material-button alt-2">
                    <span class="shape"></span>
                </div>
                <div class="title">仅初始化后可注册</div>
                <div class="input">
                    <label for="regname">用户名</label>
                    <input type="text" name="regname" id="regname">
                    <span class="spin"></span>
                </div>
                <div class="input">
                    <label for="regpass">密码</label>
                    <input type="password" name="regpass" id="regpass">
                    <span class="spin"></span>
                </div>
                <div class="input">
                    <label for="reregpass">确认密码</label>
                    <input type="password" name="reregpass" id="reregpass">
                    <span class="spin"></span>
                </div>
                <div class="button">
                    <button  onclick="buttonclick()" >
                        <span >注册</span>
                    </button>
                </div>
            </div>
    </div>

<script type="text/javascript" src="../../layuiadmin/jquery.js"></script>

<script type="text/javascript">


    function buttonclick() {
        if ($("input#regpass").val() != $("input#reregpass").val()) {
            alert("两次输入密码不一致，请重新输入");
        } else {

            var user = {
                userName: $("input#regname").val(),
                password: $("input#regpass").val(),
            }
            // console.log(user);
            $.ajax(
                {
                    url: '/initRegister',
                    data: JSON.stringify(user),
                    contentType: 'application/json',
                    datatype: 'json',
                    method: 'post',
                    success: function (res) {
                        alert(res.msg);
                    },
                    error: function (res) {
                        alert(res.msg);
                    }
                }
            )
        }

    }
</script>

<script src="layuiadmin/index.js"></script>

</body>
</html>